{% extends 'base.html' %}

{% block title %}测试邮件配置 - EasyTesting{% endblock %}

{% block header %}测试邮件配置: {{ config.name }}{% endblock %}

{% block header_buttons %}
<a href="{% url 'email_config_list' %}" class="btn btn-secondary">
    <i class="bi bi-arrow-left"></i> 返回列表
</a>
{% endblock %}

{% block content %}
<div class="card">
    <div class="card-header">
        <i class="bi bi-info-circle"></i> 测试说明
    </div>
    <div class="card-body">
        <p>此功能将使用当前配置发送一封测试邮件，以验证邮件发送功能是否正常工作。</p>
        <p>测试邮件将从 <strong>{{ config.default_from_name }} &lt;{{ config.default_from_email }}&gt;</strong> 发送。</p>
    </div>
</div>

<div class="card mt-4">
    <div class="card-body">
        <form method="post" novalidate>
            {% csrf_token %}

            <div class="form-group mb-3">
                <label for="{{ form.email.id_for_label }}" class="form-label">{{ form.email.label }}</label>
                {{ form.email }}
                {% if form.email.help_text %}
                <small class="form-text text-muted">{{ form.email.help_text }}</small>
                {% endif %}
                {% if form.email.errors %}
                <div class="invalid-feedback d-block">
                    {{ form.email.errors }}
                </div>
                {% endif %}
            </div>

            <div class="d-grid gap-2 d-md-flex justify-content-md-end">
                <a href="{% url 'email_config_list' %}" class="btn btn-secondary me-md-2">取消</a>
                <button type="submit" class="btn btn-primary">
                    <i class="bi bi-envelope"></i> 发送测试邮件
                </button>
            </div>
        </form>
    </div>
</div>
{% endblock %}
